Skip to content

[codex] Refactor desktop settings Effect services#3188

Merged
juliusmarminge merged 2 commits into
mainfrom
codex/effect-service-desktop-settings
Jun 20, 2026
Merged

[codex] Refactor desktop settings Effect services#3188
juliusmarminge merged 2 commits into
mainfrom
codex/effect-service-desktop-settings

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Inlines the desktop settings and connection-catalog service contracts on their Context.Service tags.
  • Removes standalone settings shape aliases and updates consumers to namespace imports, qualified access, and Service["Service"] types.
  • Exports canonical effectful make values and layer constants for all four services without synthetic wrappers.
  • Models filesystem, document-decode, secret-decode, write, and migration failures as distinct schema errors with structured attributes while retaining each immediate wrapped failure as cause.
  • Preserves existing settings persistence, encryption, migration, and server-exposure behavior.

Scope

The final diff is limited to the desktop settings and connection-catalog services plus focused error-classification tests. There are no orchestration, MCP, or server-exposure changes.

Validation

  • Four relevant desktop suites — 4 files / 41 tests passed
  • vp check — passed; 20 pre-existing unrelated warnings
  • vp run typecheck — passed
  • git diff --check origin/main...HEAD — passed
  • Structured-error audit — wrapped failures retain their immediate cause; messages use stable structural attributes and never cause text
  • Stale shape and named service-import audits — no violations
  • Review-thread audit — no unresolved threads before the final push

Note

Low Risk
Refactor is localized to desktop persistence error typing and layer wiring; persistence and encryption behavior are preserved and covered by expanded tests.

Overview
Refactors four desktop Effect services (DesktopAppSettings, DesktopClientSettings, DesktopSavedEnvironments, DesktopConnectionCatalogStore) so failures are typed, stage-specific errors instead of generic read/write wrappers around platform or schema causes.

Error model: Data.TaggedError becomes Schema.TaggedErrorClass with structured fields—operation, path / catalogPath / registryPath, optional environmentId or field—and stable user-facing message strings that do not echo raw underlying errors. JSON envelope failures are split from filesystem reads (*DocumentDecodeError vs *ReadError); encrypted payload/base64 issues use dedicated decode errors. Secret-related messages are built so invalid blob content (e.g. %%%) is not leaked.

Service shape: Standalone *Shape interfaces are removed; contracts live on each Context.Service tag. Layers are built via exported make + Layer.effect(..., make); tests and mocks use Service["Service"] where needed.

Behavior: Persistence, encryption, legacy migration, and settings semantics are unchanged; tests are expanded to assert error class, operation, paths, and message content for read/write/decode/migration paths.

Reviewed by Cursor Bugbot for commit 037db6d. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Refactor desktop settings services to use structured, tagged error classes

  • Replaces generic error classes in DesktopAppSettings, DesktopClientSettings, DesktopSavedEnvironments, and DesktopConnectionCatalogStore with Schema.TaggedErrorClass variants that include structured fields: operation, path/registryPath/catalogPath, and cause.
  • Each write path now maps individual failure stages (e.g. encode-document, create-directory, write-temporary-file, replace-settings-file) to distinct operation literals on the error, providing stable messages that don't echo underlying error content.
  • Read paths now distinguish between filesystem read failures and JSON decode failures using separate error classes (e.g. DesktopSavedEnvironmentsReadError vs DesktopSavedEnvironmentsDocumentDecodeError).
  • Secret decode errors include environment ID, registry/catalog path, and field name while avoiding leaking sensitive content.
  • Service construction is refactored from inline layer logic into a make factory function; method signatures and success-path behavior are unchanged.

Macroscope summarized 037db6d.

@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1a22a4f0-bfb9-4826-9b2b-eaeedc90c68b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/effect-service-desktop-settings

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
@github-actions

github-actions Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

🚀 Expo continuous deployment is ready!

  • Project → t3-code
  • Platforms → android, ios
  • Scheme → t3code-preview
  🤖 Android 🍎 iOS
Fingerprint fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea ae3bd597809dfd7771d0898f735d172973d4c1c8
Build Details Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
App version: 0.1.0
Git commit: f30c72047f910d3c63edf84887f4c6392d72a650
Build Permalink
DetailsDistribution: INTERNAL
Build profile: preview:dev
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
App version: 0.1.0
Git commit: b4706aa685da92ae179e34c97839c2a0e9840f09
Update Details Update Permalink
DetailsBranch: pr-3188
Runtime version: fe5a51f2e189da69dfc4c2cd458e6cfb5fdff2ea
Git commit: 148d7607b1c2c383f8bc419c9f7f8167f206b496
Update Permalink
DetailsBranch: pr-3188
Runtime version: ae3bd597809dfd7771d0898f735d172973d4c1c8
Git commit: 148d7607b1c2c383f8bc419c9f7f8167f206b496
Update QR

@juliusmarminge juliusmarminge marked this pull request as ready for review June 20, 2026 02:06
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Pure refactor of desktop settings Effect services that improves error class structure and message detail without changing runtime behavior. Error classes migrated to Schema.TaggedErrorClass with richer context fields, and make functions extracted for better composability.

You can customize Macroscope's approvability policy. Learn more.

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from 50b4ddb to 3236e4a Compare June 20, 2026 02:35
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 02:35

Dismissing prior approval to re-evaluate 3236e4a

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from 3236e4a to a17e8af Compare June 20, 2026 03:06
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 03:06

Dismissing prior approval to re-evaluate a17e8af

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from a17e8af to d83af36 Compare June 20, 2026 03:22
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 03:22

Dismissing prior approval to re-evaluate d83af36

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch 2 times, most recently from 554e0ac to d84fb7e Compare June 20, 2026 04:34
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 04:34

Dismissing prior approval to re-evaluate d84fb7e

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from d84fb7e to 6ec2bb6 Compare June 20, 2026 05:18
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from 6ec2bb6 to c9ad561 Compare June 20, 2026 05:42
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 05:43

Dismissing prior approval to re-evaluate c9ad561

@github-actions github-actions Bot added size:XL 500-999 changed lines (additions + deletions). and removed size:L 100-499 changed lines (additions + deletions). labels Jun 20, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@juliusmarminge juliusmarminge force-pushed the codex/effect-service-desktop-settings branch from c9ad561 to 037db6d Compare June 20, 2026 05:51
@macroscopeapp macroscopeapp Bot dismissed their stale review June 20, 2026 05:52

Dismissing prior approval to re-evaluate 037db6d

@juliusmarminge juliusmarminge merged commit 65385c0 into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/effect-service-desktop-settings branch June 20, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant